import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'homeview',
    component: HomeView,
  },
  {
    path: '/hotellist/:hid',
    name: '/home/hotellist',
    component: () => import('../views/hotel/HotelList.vue'),
  },
  {
    path: '/web-info-about',
    name: '/web-info-about',
    component: () => import('../views/WebinfoAbout.vue'),
  },
  
  {
    path: '/nearbyhotel',
    name: '/nearbyhotel',
    component: () => import('../views/hotel/NearbyHotel.vue'),
  },
  {
    path: '/hotelroom/:rid',
    name: '/home/hotelroom',
    component: () => import('../views/hotel/HotelRoom.vue'),
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login.vue'),
  },
  {
    path: '/spot',
    name: 'spot',
    component: () => import('../views/spot/SpotList.vue'),
  },
  {
    path: '/spot/spotdetails/:qid',
    name: 'spotdetails', // 不重复即可
    component: () => import('../views/spot/SpotDetails.vue'),
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/register.vue'),
  },
  {
    path: '/contact',
    name: '/contact',
    component: () => import('../views/contact.vue'),
  },
  {
    path: '/consult',
    name: '/consult',
    component: () => import('../views/consult.vue'),
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ '../views/AboutView.vue'),
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/PersonView.vue'),
    children: [
      {
        path: 'index',
        name: '/home/index', // 不重复即可
        component: () => import('../views/Index.vue'),
      },
      {
        path: 'xitong',
        name: '/home/xitong', // 不重复即可
        component: () => import('../views/xitong.vue'),
      },
      {
        path: 'order',
        name: '/home/order', // 不重复即可
        component: () => import('../views/order.vue'),
        children: [
          {
            path: '/home/order',
            redirect: '/home/order/order1'
          },
          {
            path: 'order1',
            name: '/home/order/order1', // 不重复即可
            component: () => import('../views/order/order1.vue'),
          },
          {
            path: 'order2',
            name: '/home/order/order2', // 不重复即可
            component: () => import('../views/order/order2.vue'),
            
          },
        ]
      },
      {
        path: 'help',
        name: '/home/help', // 不重复即可
        component: () => import('../views/help.vue'),
      },
      {
        path: 'address',
        name: '/home/address', // 不重复即可
        component: () => import('../views/management/address.vue'),
      },
      {
        path: 'passenger',
        name: '/home/passenger', // 不重复即可
        component: () => import('../views/management/passenger.vue'),
      },
      {
        path: 'xinxi',
        name: '/home/xinxi', // 不重复即可
        component: () => import('../views/user/xinxi.vue'),
      },
      {
        path: 'comment',
        name: '/home/comment', // 不重复即可
        component: () => import('../views/user/comment.vue'),
      },
      {
        path: 'store',
        name: '/home/store', // 不重复即可
        component: () => import('../views/user/store.vue'),
      },
      {
        path: 'pwd',
        name: '/home/pwd', // 不重复即可
        component: () => import('../views/user/pwd.vue'),
      },
      {
        path: '/test',
        name: 'test',

        component: () =>
          import(/* webpackChunkName: "about" */ '../views/user/test.vue'),
      },
    ],
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
})

export default router
